<?php
if (isset($_REQUEST["sendnewacc"]))
{
	$success = true;
	$validator = array("type" => "isPosted",
						"name" => "isPosted");

	$success = validateForm($validator, $_REQUEST);

	if (validateForm($validator, $_REQUEST))
	{
		if (!setNewAccount($_SESSION["userid"], $_REQUEST["type"], $_REQUEST["name"], $_REQUEST["bankname"], $_REQUEST["accountnumber"], $_REQUEST["description"]))
		{
			$success = false;
		}
	}
	else
	{
		$success = false;
	}
}
?>
			<div id="textcontainer">
				<h2>Új számla</h2>
				<p>
					<?php if (isset($success) && !$success) print "<div class=\"errortitle\">valami nem sikerult!</div>";?>
					<form name="newaccount" action="<?php print $_SERVER["SCRIPT_NAME"] . "?" . $_SERVER["QUERY_STRING"];?>" method="post">
						típus: <select name="type">
						<option value="B"<?php print (isset($_REQUEST["type"]) && !$success && ($_REQUEST["type"] == "B"))?' selected="selected"':"";?>>bank</option>
						<option value="C"<?php print (isset($_REQUEST["type"]) && !$success && ($_REQUEST["type"] == "C"))?' selected="selected"':"";?>>készpénz</option>
						</select><br/>
						név: <input type="text" name="name"<?php print (isset($_REQUEST["name"]) && !$success)?' value="' . $_REQUEST["name"] . '"':"";?>/><br/>
						bank: <input type="text" name="bankname"<?php print (isset($_REQUEST["bankname"]) && !$success)?' value="' . $_REQUEST["bankname"] . '"':"";?>/><br/>
						számlaszám: <input type="text" name="accountnumber"<?php print (isset($_REQUEST["accountnumber"]) && !$success)?' value="' . $_REQUEST["accountnumber"] . '"':"";?>/><br/>
						leírás: <textarea name="description"><?php print (isset($_REQUEST["description"]) && !$success)?$_REQUEST["description"]:"";?></textarea><br/>
						<input type="submit" name="sendnewacc" value="Ment"/>
					</form>
				</p>
			</div>
			<!---->
